global
  log 127.0.0.1 local0
  log 127.0.0.1 local1 notice
  tune.ssl.default-dh-param 2048

defaults
  log global
  mode http
  #option httplog
  option dontlognull
  timeout connect 5000ms
  timeout client 50000ms
  timeout server 50000ms

listen stats
    bind :{{ haproxy_stats_port }}
    mode http
    balance
    stats uri {{ haproxy_stats_url }}
    stats auth {{ haproxy_admin_username }}:{{ haproxy_admin_password }}
    stats admin if TRUE

frontend api-https
   mode tcp
   bind :{{ k8s_master_haproxy_bind_port }}
   default_backend api-backend

backend api-backend
    mode tcp
{% for host in groups['kube-master'] %}
    server  {{ hostvars[host]['ansible_nodename'] }}  {{ hostvars[host].ansible_default_ipv4.address }}:5443  check
{% endfor %}
{% for host in groups['k8s-cluster-add-master'] %}
    server  {{ hostvars[host]['ansible_nodename'] }}  {{ hostvars[host].ansible_default_ipv4.address }}:5443  check
{% endfor %}